package com.zx.mes.demo.hyl.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * nacos base config
 *
 * @author 华云龙
 * @date 2019-2-14
 */
@RestController
@RequestMapping("/env")
@RefreshScope
public class EnvController {

    @Value("${current.env:pro}")
    private String env;

    /**
     * http://localhost:9991/api/demo/env/getEnv
     *
     * @return str
     */
    @PreAuthorize("hasAuthority('xx:save')")
    @GetMapping("/getEnv")
    public String getEnv() {
        return "当前环境:[" + env + "]";
    }

    @GetMapping("/test")
    public String getTest(){
        return "返回测试结果!";
    }
}
